#!/bin/bash

JAR_NAME="wx-program-jj-0.0.1-SNAPSHOT.jar"
PID=$(pgrep -f $JAR_NAME)
if [ ! -z "$PID" ]; then
  kill -9 $PID
  echo "进程ID: $PID 被杀掉了"
fi
sleep 5
JAR_PATH="/usr/local/java/wx-program-jj-0.0.1-SNAPSHOT.jar"
nohup java -jar ${JAR_PATH} &> /usr/local/java/log_output.log &
echo "新的进程ID:$(pgrep -f $JAR_NAME)"